<div class="bg-light lter b-b wrapper-md ng-scope">
    <h4 class="m-n font-thin">修改商户</h4>
    <button ui-sref="app.merchants" class="btn-back btn btn-dark btn-sm btn-rounded">
        返回
    </button>
</div>
<div class="wrapper-md" ng-controller="merchantsViewCtrl">
    <div class="panel panel-default">
        <div class="panel-heading m-n">
            编辑商户信息
        </div>
        <div class="panel-body">
            <form name="merchantsEditform" class="form-horizontal ng-pristine ng-valid ng-valid-date ng-valid-required ng-valid-parse ng-valid-date-disabled"
                  method="POST" ng-submit="editMerchants()">
                <div class="form-group">
                    <label class="col-sm-2 control-label">行业</label>
                    <div class="col-sm-5">
                        <select class="form-control" ng-model="shopUpdateVO.industryId" ng-options="merchant.id as merchant.fullName for merchant in data"></select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">联系人</label>
                    <div class="col-sm-5">
                        <input type="text" ng-model="shopUpdateVO.linkman" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">联系电话</label>
                    <div class="col-sm-5">
                        <input type="text" ng-model="shopUpdateVO.mobilePhone" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">店铺名称</label>
                    <div class="col-sm-5">
                        <input type="text" ng-model="shopUpdateVO.name" class="form-control">
                    </div>
                </div>
                <div class="form-group" ng-if="shopUpdateVO.isPlatform==0">
                    <label class="col-sm-2 control-label">店铺让利值</label>
                    <div class="col-sm-5 inline">
                        <input type="number" ng-model="shopUpdateVO.profit" name="profit" min="5" max="100" step="0.01" ng-pattern="/^[0-9]+(.[0-9]{1,2})?$/" class="form-control">
                    </div>
                    <div class="m-t-xs inline" ng-if="merchantsEditform.profit.$touched">
                        <span class="text-danger h6" ng-if="merchantsEditform.profit.$error.min">店铺让利值不得低于最小值</span>
                        <span class="text-danger h6" ng-if="merchantsEditform.profit.$error.max">店铺让利值不得高于最大值</span>
                        <span class="text-danger h6" ng-if="merchantsEditform.profit.$error.pattern">店铺让利值最多保留两位小数</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">到期时间</label>
                    <div class="col-sm-5" >
                        <div class="inline" ng-controller="DatepickerDemoCtrl">
                            <div class="input-group w-full">
                                <input type="text" class="form-control" placeholder="请输入到期时间" alt-input-formats="altInputFormats" uib-datepicker-popup="yyyy-MM-dd" datepicker-popup="yyyy-MM-dd" ng-model="shopUpdateVO.expireTime"
                                       alt-input-formats="altInputFormats" is-open="opened" min-date="minDate" datepicker-options="dateOptions" close-text="关闭" clear-text="清空" current-text="今天" readonly/>
                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                                    </span>
                            </div>
                        </div>
                    </div>
                    <div class="m-t-xs inline" ng-if="shopUpdateVO.expireTime != null && compare()">
                        <span class="text-danger h6">该店铺已过期，请重新修改到期时间！</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">经度</label>
                    <div class="col-sm-5">
                        <input type="text" ng-model="shopUpdateVO.lat" readonly class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">纬度</label>
                    <div class="col-sm-5">
                        <input type="text" ng-model="shopUpdateVO.lng" readonly class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">店铺地址</label>
                    <div class="col-sm-5">
                        <input type="text" ng-model="shopUpdateVO.address" readonly class="form-control">
                    </div>
                </div>

                <div class="form-group" ng-if="shopUpdateVO.isPlatform==0">
                    <label class="col-sm-2 control-label">是否分销</label>
                    <div class="col-sm-5">
                        <div class="pull-left">
                            <label class="i-switch m-t-xs m-r">
                                <input type="checkbox"  ng-model="shopUpdateVO.isOpenSell" ng-true-value="1" ng-false-value="0" ng-click="selectSell(shopUpdateVO.isOpenSell)">
                                <i></i>
                            </label>
                        </div>
                        <label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopUpdateVO.isOpenSell]"></label>
                    </div>
                </div>

                <div class="form-group" ng-if="shopUpdateVO.isPlatform==0">
                    <label class="col-sm-2 control-label">是否返利</label>
                    <div class="col-sm-5">
                        <div class="pull-left">
                            <label class="i-switch m-t-xs m-r">
                                <input type="checkbox"  ng-model="shopUpdateVO.isOpenRebate" ng-true-value="1" ng-false-value="0"  ng-click="selectRebate(shopUpdateVO.isOpenRebate)">
                                <i></i>
                            </label>
                        </div>
                        <label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopUpdateVO.isOpenRebate]"></label>
                    </div>
                </div>
                <div class="form-group" ng-if="checkType()">
                    <label class="col-sm-3 control-label text-danger h6 ">*请至少选择一项销售类型</label>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">是否直邮</label>
                    <div class="col-sm-5">
                        <div class="pull-left">
                            <label class="i-switch m-t-xs m-r">
                                <input type="checkbox"  ng-model="shopUpdateVO.isMail" ng-true-value="1" ng-false-value="0">
                                <i></i>
                            </label>
                        </div>
                        <label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopUpdateVO.isMail]"></label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">是否到店</label>
                    <div class="col-sm-5">
                        <div class="pull-left">
                            <label class="i-switch m-t-xs m-r">
                                <input type="checkbox"  ng-model="shopUpdateVO.isShop" ng-true-value="1" ng-false-value="0">
                                <i></i>
                            </label>
                        </div>
                        <label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopUpdateVO.isShop]"></label>
                    </div>
                </div>

                <div class="form-group" ng-if="shopUpdateVO.isPlatform==1">
                    <label class="col-sm-2 control-label">是否配送</label>
                    <div class="col-sm-5">
                        <div class="pull-left">
                            <label class="i-switch m-t-xs m-r">
                                <input type="checkbox"  ng-model="shopUpdateVO.isDelivery" ng-true-value="1" ng-false-value="0" >
                                <i></i>
                            </label>
                        </div>
                        <label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopUpdateVO.isDelivery]"></label>
                    </div>
                </div>

                <div class="form-group" ng-if="shopUpdateVO.isPlatform==1">
                    <label class="col-sm-2 control-label">是否堂食</label>
                    <div class="col-sm-5">
                        <div class="pull-left">
                            <label class="i-switch m-t-xs m-r">
                                <input type="checkbox"  ng-model="shopUpdateVO.isEat" ng-true-value="1" ng-false-value="0" >
                                <i></i>
                            </label>
                        </div>
                        <label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopUpdateVO.isEat]"></label>
                    </div>
                </div>
                <div class="form-group" ng-if="check()">
                    <label class="col-sm-3 control-label text-danger h6 ">*请至少选择一项服务类型</label>
                </div>
                <!--<div class="form-group" ng-if="shopUpdateVO.isPlatform==1">-->
                    <!--<label class="col-sm-2 control-label">是否预定</label>-->
                    <!--<div class="col-sm-10">-->
                        <!--<div class="pull-left">-->
                            <!--<label class="i-switch m-t-xs m-r">-->
                                <!--<input type="checkbox"  ng-model="shopUpdateVO.isReserve" ng-true-value="1" ng-false-value="0">-->
                                <!--<i></i>-->
                            <!--</label>-->
                        <!--</div>-->
                        <!--<label class="pull-left m-t-xs" ng-bind="{1:'已开启',0:'未开启'}[shopUpdateVO.isReserve]"></label>-->
                    <!--</div>-->
                <!--</div>-->
                <div class="line line-dashed b-b line-lg pull-in"></div>
                <div class="form-group ">
                    <div class="col-sm-4 col-sm-offset-2">
                        <button type="submit" class="btn btn-success" ng-disabled="merchantsEditform.$invalid || check() || checkType()">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>




